package com.jnu.keepaccounts;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;

import com.jnu.keepaccounts.data.DataTiaoMu;

public class RecordDetail extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.details);

        ActionBar actionBar = getSupportActionBar();
        if(actionBar!= null){
            actionBar.hide();
        }
        ImageButton imageButton= findViewById(R.id.back);
        imageButton.setOnClickListener(v -> finish());
        Intent intent = getIntent();
        DataTiaoMu dataTiaoMu = (DataTiaoMu) intent.getSerializableExtra("datatiaomu");

        TextView jine = findViewById(R.id.jine);
        jine.setText(Math.abs(dataTiaoMu.getShuE())+"");
        ImageView imageView = findViewById(R.id.image_fenlei);
        imageView.setImageResource(dataTiaoMu.getImage());
        TextView text_zhangmufenlei = findViewById(R.id.fenlei);
        text_zhangmufenlei.setText(dataTiaoMu.getXiangMu());
        TextView text_leixing = findViewById(R.id.leixing);
        text_leixing.setText(dataTiaoMu.getShuE()>0?"收入":"支出");
        TextView yusuan = findViewById(R.id.yusuan);
        yusuan.setText(dataTiaoMu.getYusuan()==1?"不计预算":"计入预算");
        TextView text_account = findViewById(R.id.account);
        text_account.setText(dataTiaoMu.getLaiYuan());
        TextView text_riqi = findViewById(R.id.riqi);
        text_riqi.setText(dataTiaoMu.getYear()+"-"+dataTiaoMu.getMonth()+"-"+dataTiaoMu.getDay());
        TextView text_yue = findViewById(R.id.yue);
        text_yue.setText(intent.getDoubleExtra("yue",0)+"");
    }
}
